{extend name="common/base_page" /}

{block name="title"}进销存查询{/block}

{block name="jscssfile"}{/block}

{block name="css"}
<style type="text/css">
body{ background: #ffffff; height:100vh; }
.layui-fluid {
    padding:10px 15px;
}
.layui-tab {
    margin: 0 0;
}
.layui-tab-content{  
  padding:0px;
}
.layui-tab-content .layui-tab-item{
  height:100vh;
}
#bar_box_one{
  padding: 0px 0px 5px 0px;
  margin-bottom:0px;
}
.layui-table, .layui-table-view { margin:0; }
.layui-form-item .layui-input-inline { margin-right: 0px; }
.line-top-tjbox{margin-left:10px;}
</style>
{/block}

{block name="body"}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12" style="height:100vh;padding:0;">

            <div class="layui-form-item" id="bar_box_one">
                <a class="layui-btn layui-btn-warm" href="{:url('index/store.kucun/index')}">返回</a>
                {if $drugs_id gt 0}
                <span class="line-top-tjbox">{$drugs_name} - 进销存详情</span>
                {/if}
                <div class="layui-input-block" style="float: right;">
                  <form class="layui-form" action="">
                      <div class="layui-inline">
                        <label class="layui-form-label">出入库日期</label>
                        <div class="layui-input-inline">
                          <input type="text" name="ipt_date" id="ipt_date" autocomplete="off" class="layui-input">
                        </div>
                      </div>
                      <div class="layui-inline">
                        <label class="layui-form-label" style="width:80px;padding: 9px 15px 9px 0;">出入库方式</label>
                        <div class="layui-input-inline">
                          <select id="type" name="type">
                              <option value="ALL">全部</option>
                              {volist name="crk_type_list" id="vo"}
                              <option value="{$vo.id}">{$vo.name}</option>
                              {/volist}
                          </select>
                        </div>
                      </div>
                      <div class="layui-inline">
                        <div class="layui-input-inline">
                          <input type="text" name="keyword" id="keyword" maxlength="10" placeholder="名称/拼音码/五笔码" autocomplete="off" class="layui-input" value="{$drugs_name}">
                        </div>
                      </div>
                      <div class="layui-inline">
                          <a class="layui-btn layui-btn-normal" onclick="_p = 1;_loadList();">搜索</a>
                      </div>
                    </form>
                </div>
            </div>
            <div class="layui-tab-content">
                  <div class="layui-tab-item layui-show">
                      <table id="LAY-app-content-comm" lay-filter="LAY-app-content-comm"></table>
                  </div>
            </div>

        </div>
    </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
var _p = 1;
$(function(){
  setTimeout(function(){
      //日期范围
      laydate.render({ elem: '#ipt_date',range: true });
      _loadList();
  },50);
});
</script>
<script type="text/javascript">
//加载数据
function _loadList()
{
      __showLoadingBox('请稍候...');
      var  _zero_noshow = 0;
      if($('#zero_noshow').prop('checked')) _zero_noshow = 1;
      laytable.render({
          elem: '#LAY-app-content-comm'//指定表格元素
          ,url:"{:url('index/store.kucun/inout_query')}"
          ,method:'post'  //提交方式
          ,where:{
            drugs_id:'{$drugs_id}',
            create_time:$.trim($('#ipt_date').val()),
            type:$.trim($('#type').val()),
            keyword:$.trim($('#keyword').val()),
            page:_p
          } //post json数据
          ,page: {layout: ['count', 'prev', 'page', 'next', 'skip'],first: true,last: true}
          ,skin: 'line '  //表格风格 line （行边框风格）row （列边框风格）nob （无边框风格）
        　,even: true    //隔行换色
          ,limit: 20     //每页默认显示的数量
          ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
          ,height: 'full-100' //表格高度，layui 2.2.1 新增 , full-100 为适应最大高度或其它数值500
          ,cols: [[
            {field:'type_txt', width:120, align:'center', title: '出入库方式'}
            ,{field:'create_time', width:130, align:'center', title: '日期',sort: true}
            ,{field:'inout_sn', width:180, align:'center', title: '单号',sort: true}
            ,{field:'num', width:130, align:'center', title: '数量',sort: true}
            ,{field:'unit', width:100, align:'center', title: '单位'}
            ,{field:'price', width:130, align:'center', title: '进货价',sort: true}
            ,{field:'ls_price', width:130, align:'center', title: '零售价',sort: true}
            ,{field:'batch_sn', width:130, align:'center', title: '批号',sort: true}
            ,{field:'except_time', width:130, align:'center', title: '有效期',sort: true}
            ,{field:'changjia', minwidth:200, title: '生产厂商'}
          ]]
          ,done:function(datalist,curr,page){
              __hideLoadingBox();
          }
      });
}
</script>
{/block}